﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Files.aspx.cs" Inherits="UpdateApp.Files" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    <title>文件列表</title>
    <link href="CSS/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet" />
    <style>
        .font {
            margin: 8px 10px;
            width: 8rem;
            font-size: 2rem;
        }
    </style>
</head>

<script src="JavaScript/JQuery-1.9.1.min.js"></script>
<script src="CSS/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>

<% if (type == "")
   { %>
<script src="//open.thunderurl.com/thunder-link.js"></script>
<% } %>

<body>
    <button type="button" class="btn btn-default font" onclick='window.location.href = "Default.aspx<%=type == "" ? "" : "?type=0"%>"'>上传</button>
    <table class="table table-hover" style="margin: 10px 20px; width: 97%">
        <caption>文件列表</caption>
        <thead>
            <tr>
                <th>操作</th>
                <th>文件</th>
                <th>大小</th>
                <th class="date">上传时间</th>
            </tr>
        </thead>
        <tbody>
            <tr style='display:<%=date =="" ? "" : "none" %>''>
                <td></td>
                <td><a href="?date=<%=temp %>">临时空间</a></td>
                <td></td>
                <td class="date"></td>
            </tr>
            <% foreach (var item in list.Keys)
               { %>
            <tr>
                <td>
                    <div class="btn-group">
                        <button type="button" class="btn btn-default"><a href="<%=path%>/<%=item%>" download="<%=item%>">下载</a></button>
                        <div class="btn-group">
                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                更多
                            <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu">
                                <li><a class="thunder-link" name="thunder" href="#" val="<%=path%>/<%=item%>">迅雷下载</a></li>
                                <li><a href="?date=<%=date%>&temp=<%=item%><%=type == "" ? "" : "&type=0" %>">临时空间</a></li>
                                <li><a href="?date=<%=date%>&name=<%=item%><%=type == "" ? "" : "&type=0" %>" onclick="return confirm('确定要删除吗？')">删除</a></li>
                            </ul>
                        </div>
                    </div>
                </td>
                <td><a href="<%=path%>/<%=item%>" target="_blank"><%=item%></a></td>
                <td><%=list[item].Split('|')[0]%></td>
                <td class="date"><%=list[item].Split('|')[1]%></td>
            </tr>
            <% } %>
        </tbody>
    </table>
</body>
</html>
<script>

    setTimeout(function () { window.close() }, 600000); //十分钟关闭

    var browser = {
        versions: function () {
            var u = navigator.userAgent,
            app = navigator.appVersion;
            return {
                mobile: !!u.match(/AppleWebKit.*Mobile.*/),
                ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
                android: u.indexOf("Android") > -1 || u.indexOf("Linux") > -1,
                iPhone: u.indexOf("iPhone") > -1,
                iPad: u.indexOf("iPad") > -1
            };
        }(),
        language: (navigator.browserLanguage || navigator.language).toLowerCase()
    };

    //移动端隐藏上传时间
    if (browser.versions.mobile) {
        $(".date").hide();
    }

    $(function () {
        //https://open.thunderurl.com/
        $("a[name=thunder]").click(function () {
            thunderLink.newTask({
                downloadDir: '',
                tasks: [{
                    name: '',
                    url: window.location.protocol + "//" + window.location.host + "//" + $(this).attr("val")
                }]
            });
        });
    });
</script>
